package June;

public class Test_23_1 {
    public static void main(String[] args) {
        person3 person3 = new person3("king", 18);
        Student student = new Student("jack", 17 , 123456789, 99.9);

        System.out.println(person3.say());
        System.out.println(student.say());
    }
}

// 编写一个Person类，包括属性/private(name、age)，
// 构造器、方法say(返回自我介绍的字符串)
// 编写-个Student类，继承Person类，增加id、score属性/private，
// 以及构造器，定义say方法(返回自我介绍的信息)。
// 在main中,分别创建Person和Student对象，调用say方法输出自我介绍
class person3 {
    private String name;
    private int age;

    public person3() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public person3(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String say() {
        return "我的名字是：" + getName() + " 年龄：" + getAge();
    }
}

// 编写-个Student类，继承Person类，增加id、score属性/private，
// 以及构造器，定义say方法(返回自我介绍的信息)。
class Student extends person3 {
    private int id;
    private double score;

    public Student() {
    }

    public Student(int id, double score) {
        this.id = id;
        this.score = score;
    }

    public Student(String name, int age, int id, double score) {
        super(name, age);
        this.id = id;
        this.score = score;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public String say() {
        return super.say() + " id:" + getId() + " score:" + getScore();
    }
}